﻿<div class="container-fluid adminForm" id="app">

    <div class="row">
        <!--表单控件-->
        @(UI.Input<Sys_Function>(w => w.Function_Num, 12))
        @(UI.Input<Sys_Function>(w => w.Function_Name, 12))
        @(UI.Input<Sys_Function>(w => w.Function_ByName, 12))
    </div>

    <!--按钮组start-->
    <div class="formToolbar">
        <div class="row">
            <div class="col-sm-6"></div>
            <div class="col-sm-6 text-right">
                <button class="btn btn-primary" @@click="formKey=''" v-show="formKey">添加</button>
                <button class="btn btn-success" @@click="save">保存</button>
                <button class="btn btn-danger" @@click="adminFormObject.closeWindow()">关闭</button>
            </div>
        </div>
    </div>
    <!--按钮组end-->
</div>

@section Styles{
    <!--STYLE-->
    <style type="text/css">
    </style>
}
@section Scripts{
    <!--SCRIPT-->
    <script src="~/admin/js/adminForm.js"></script>
    <script type="text/javascript">
    var app = new Vue({
        el: "#app",
        data: {
            formKey:'@ViewBag.FormKey',//表单主键
            adminFormObject: {},
            @(UI.CreateViewModel(new Sys_Function()))
        },
        watch: {
            formKey: function (newV, oldV) {
                this.load();
            }
        },
        mounted: function () {//页面加载完成
            this.adminFormObject = new adminForm(this,["adminFormObject"]);
            this.load();
        },
        //函数集合
        methods: {
            load: function () {
                var loadUrl = "@Url.Action("LoadForm")";
                //初始化页面数据
                this.adminFormObject.init({
                    formKey: this.formKey,
                    url: loadUrl,
                    callBack: function (r) { console.log(r); }
                });
            },
            //保存
            save: function () {
                var loadUrl = "@Url.Action("Save")";
                console.log(1);
                //
                this.adminFormObject.save({
                    url: loadUrl,
                });
            },
            //查找带回
            findBack: function (row, tag) {

            },
        }
    });
    </script>
}
